const html = require("html-webpack-plugin");
const webpack = require("webpack");

const path = require("path");

const PATHS = {
  app: path.join(__dirname, 'app'),
  build: path.join(__dirname, 'build'),
};

module.exports = {

	entry:{
		app:"./app/index.js"
	},
	mode:"development",
	output:{
		path: PATHS.build,
		filename:"[name].[hash:16].js"
	},
	plugins:[
		new html({
			title:"hot-webpack"
		}),
	   new webpack.HotModuleReplacementPlugin(),
 	   new webpack.NamedModulesPlugin(),
	],
	devServer:{
		hot:true,
		inline:true,
		contentBase:path.resolve(__dirname,'dist'),
		historyApiFallback: true,
		quiet: false, //控制台中不输出打包的信息
        noInfo: false,
        compress:true,
        progress: false, //显示打包的进度
		overlay:{  //把编译的错误显示在浏览器上
            errors:true,
            warnings:true,
        },
		watchOptions: {
		            aggregateTimeout: 300,
		            ignored: /node_modules/,
		        },
		port: '8094', //设置端口号
	}
}